#pragma once
#include "stdafx.h"
#include "Point3D.h"
#include "DrawElement.h"
#include "Point3D.h"
#include "Vector4D.h"
#include <vector>
#include <hash_set>
using namespace std;

class MillingTool:public DrawElement
{
private:
protected:
	Vector4D velocity;
	Vector4D direction;
	virtual bool surpassMovementDirectionCond(Point3D & p,const hash_set<int> * visitedPoints)=0;
	void performFloodFill(Point3D & p,hash_set<int> *& visitedPoints,vector<Point3D> *& result);
public:
	double posX;
	double posY;
	double posZ;

	//total length of milling tool in milimeters or inches
	double length;

	//tool reference point
	Point3D referencePoint;

	//distance from reference point to tool's end
	double distanceToToolEnd;

	//tool diameter
	int diameter;
	MillingTool(double length,int diameter);
	virtual ~MillingTool(void);
	void adjustDirection(const Point3D & from,const Point3D & to);
	void MoveTo(double x,double y,double z);
	virtual vector<Point3D>* GetToolSurfacePoints();
	virtual void Draw()=0;
	//Returns the milling error that is a result of the shape of tool
	virtual double GetMillingErrorAt(const Point3D & surfacePoint)=0;
};

